const setToken = (token) => {
    localStorage.setItem('token', token)
}
const getToken = () => {
    return localStorage.getItem('token')
}
const removeToken = () => {
    localStorage.removeItem('token')
}
const setAvatar = (avatar) => {
    localStorage.setItem('avatar', avatar)
}
const getAvatar = () => {
    return localStorage.getItem('avatar')
}
const removeAvatar = () => {
    localStorage.removeItem('avatar')
}
const setUser = (data) => {
    setAvatar(data.avatar)
    localStorage.setItem("userName", data.name)
    localStorage.setItem('userId', data.id)
}

const getUserName = () => {
    return localStorage.getItem('userName')
}
const logout = () => {
    removeToken()
    removeAvatar()
    localStorage.removeItem('userName')
    localStorage.removeItem('userId')
}
const getuserId = () => {
    return localStorage.getItem('userId')
}

export default {
    setToken,
    getToken,
    removeToken,
    setAvatar,
    getAvatar,
    removeAvatar,
    setUser,
    getUserName,
    logout,
    getuserId
}